<?php
namespace App\Http\Controllers\Api;

use App\Services\Facades\Sms;
use Illuminate\Http\Request;

class SmsController extends BaseController{


    public function send(Request $request){
        $rules = [
            'phone'        => 'required|regex:/^1[3456789][0-9]{9}$/',
        ];
        $this->validate($request , $rules ,['手机号格式错误']);
        $phone = $request->phone;
        if( Sms::sendVerifyCode($phone) ){
           return $this->success();
        }
        return $this->failed('发送失败');
    }

}
